package com.tian.arch.function.state

import android.view.View

/**
 * 页面状态
 */
enum class PageStatus {
    LOADING, EMPTY, ERROR, CONTENT
}

/**
 * 页面的基本能力
 * - 展示loading框
 * - 展示错误
 * - 展示empty 视图
 * - 展示内容
 */
interface PageAbility {
    fun showLoading()
    fun showError(errorMsg: String? = null)
    fun showEmpty()
    fun showContent()
}


/**
 * 页面状态改变的回调
 */
interface PageStateChangeListener {

    fun onEmptyCreated(parent: StatefulPage, statusView: View)
    fun onErrorCreated(parent: StatefulPage, statusView: View)
    fun onLoadingCreated(parent: StatefulPage, statusView: View)

    fun onStateChange(parent: StatefulPage, newStatus: PageStatus, oldStatus: PageStatus)
}



